package com.aaa.controller;

import com.aaa.enums.SyncNationReportEnum;
import com.aaa.result.Result;
import com.aaa.service.AaaService;
import com.aaa.service.SyncNationReportServiceUtil;
import com.aaa.service.TSetAncientSingletonAllocationService;
import com.aaa.sync.AncientSingletonAllocationSync;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.Map;

/**
 * @author : luoBo
 */

@RestController
@RequestMapping("/sync")
public class SyncController {

    @Autowired
    private TSetAncientSingletonAllocationService tSetAncientSingletonAllocationService;

    @Autowired
    private AncientSingletonAllocationSync ancientSingletonAllocationSync;


    @GetMapping("/syncCommon")
    private Result<Object> syncCommon(String syncCode){
        switch (syncCode) {
            case "ANCIENT_SINGLETON_ALLOCATION":
                ancientSingletonAllocationSync.sync();
                break; // 确保不会贯穿到 default 分支
            default:
                System.out.println("Unknown syncCode: " + syncCode);
                break; // 可选，但推荐加上
        }

        return Result.success();
    }


    @Autowired
    private Map<String, AaaService> aaaServiceMap;

    @GetMapping("/test001")
    private Result<Object> test001(String syncCode){
        Arrays.stream(SyncNationReportEnum.values()).forEach(SyncNationReportServiceUtil::processingData);
        return Result.success();
    }


}
